package com.gdzn.signal.enums;

import io.swagger.annotations.ApiModel;

@ApiModel(value = "SignalEnum信号量定义对象", description = "")
public enum SignalEnum {
    SIGNAL1("02111001","换电柜经度"),
    SIGNAL2("02112001","换电柜纬度"),
    SIGNAL3("02107001","换电柜总电压（单位：V）"),
    SIGNAL4("02108001","换电柜总电流（单位：A）"),
    SIGNAL5("02119001","电柜是否禁用：0：禁用 1：启用"),
    SIGNAL6("02113001","换电柜温度（单位：度）"),
    SIGNAL7("02103001","仓门状态：0 关，1 开"),
    SIGNAL8("02118001","电池仓门是否禁用（0：禁用 1：启用）"),
    SIGNAL9("02104001","电池充电状态（0：无电池，1：电池正在充电，2：电池充满，5：充电异常）"),
    SIGNAL10("02106001","电池ID"),
    SIGNAL11("02109001","电量"),
    SIGNAL12("01118001","功率温度值（单位：度）"),
    SIGNAL13("01120001","电池温度值（单位：度）"),
    SIGNAL14("02114001","电池充电时长（单位：分钟）"),
    SIGNAL15("02102001","电柜状态"),
    SIGNAL16("02001001","电池故障"),
    SIGNAL17("02002001","电池告警"),
    SIGNAL18("01121001","电池状态");

    private String code;
    private String desc;

    SignalEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }


    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    /**
     * 自己定义一个静态方法,通过code返回枚举常量对象
     * @param code
     * @return
     */
    public static SignalEnum getValue(String code) {
        for (SignalEnum orderStatus : values()) {
            if (orderStatus.getCode().equals(code)) {
                return orderStatus;
            }
        }
        return null;
    }


}
